-
Notifications
You must be signed in to change notification settings - Fork 11
refactor(FIR-46254): merge token and url caching #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
| def _token_storage(self) -> Optional[TokenSecureStorage]: | ||
| """Token filesystem cache storage. | ||
| def _get_cached_token(self) -> Tuple[Optional[str], Optional[int]]: | ||
| """If caching is enabled, get token from cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing we also return the validity of the token? What is the tuple return needed for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, token and its expiry - https://github.com/firebolt-db/firebolt-python-sdk/pull/454/files/88129aad4541917b102da74bf38f55ed6ff8f863#diff-ffbb4e973c25af4ceb5128e7cf8885e1c6c4df4949113a1e500bc8712f2ff525R140
Docstring needs to be updated.
3446035 to
436a240
Compare
|
Created merge_caching_bkp in case some merge conflicts were not resolved correctly. |
|



This pull request introduces a significant refactor of the token caching mechanism for authentication in the Firebolt Python SDK. The main changes involve replacing the previous filesystem-based token cache with a new, encrypted, file-based cache system, updating the
Authclasses to use this new cache, and removing legacy token storage code. The update also ensures that account names are consistently set in authentication objects during connection setup.Token caching and storage refactor:
FileBasedCacheclass insrc/firebolt/utils/cache.pythat provides encrypted, persistent, file-based caching for authentication tokens and connection info, replacing the oldTokenSecureStoragesystem. This includes logic for OS-specific cache directories, encryption, and expiry handling.Authclass insrc/firebolt/client/auth/base.pyto use the new_firebolt_cachefor token retrieval and storage, including adding anaccountproperty to ensure tokens are cached per-account.TokenSecureStorageand related code from the authentication classes (UsernamePassword,ServiceAccount,ClientCredentials), and deleted the compatibility import insrc/firebolt/common/token_storage.py.Connection setup improvements:
account_nameis consistently assigned to theauthobject in both async and syncconnectfunctions, which is necessary for correct token caching and retrieval.Data structure enhancements:
ConnectionInfodataclass to include atokenfield and a__post_init__method for robust deserialization of nested dataclasses from cache.